local kanpo = fk.CreateSkill {

  name = "joy__kanpo",

  tags = {  },

}



kanpo:addEffect("viewas", {
  name = "joy__kanpo",
  anim_type = "control",
  pattern = "nullification",
  prompt = "#kanpo",
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).color == Card.Black and table.contains(player.player_cards[Player.Hand], to_select)
  end,
  view_as = function(self, player,cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("nullification")
    card.skillName = kanpo.name
    card:addSubcard(cards[1])
    return card
  end,
  enabled_at_response = function (self, player, response)
    return not response and not player:isKongcheng()
  end,
})

kanpo:addEffect(fk.PreCardUse, {
  refresh_events = {fk.PreCardUse},
  can_refresh = function(self, event, target, player, data)
    return target == player and player:hasSkill(kanpo.name) and data.card.trueName == "nullification"
  end,
  on_refresh = function(self, event, target, player, data)
    data.disresponsiveList = table.map(player.room.alive_players, Util.IdMapper)
  end,
})

return kanpo